package com.yc.http;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Tomcat {

    public static void main(String[] args) throws IOException {

        ServerSocket server = new ServerSocket(80);
        while (true){
            try{
                final Socket socket = server.accept();

                final InputStream in = socket.getInputStream();
                final OutputStream out = socket.getOutputStream();

                byte[] bytes = new byte[1024*10];
                int count = in.read(bytes);

                String str = new String(bytes, 0, count);
                System.out.println(str);

                socket.close();
            } catch ( Exception e) {
                System.out.println("========" + e.getMessage());
            }
        }


    }

}
